
<!-- 正文开始 -->
<form id="admin_Add_Form" class="layui-form model-form no-padding">
    <div class="model-form-body" onscroll="layui.admin.hideFixedEl();">
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">用户名</label>
                <div class="layui-input-block">
                    <input name="username" class="layui-input"  placeholder="输入用户名" lay-verType="tips" autocomplete="off" lay-verify="required" required/>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">密码</label>
                <div class="layui-input-block">
                    <input type="password" name="password" class="layui-input"  placeholder="输入密码" autocomplete="off"  lay-verType="tips" lay-verify="required"  required/>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">手机号</label>
                <div class="layui-input-block">
                    <input name="phone" class="layui-input"  placeholder="输入手机号" autocomplete="off"  lay-verType="tips" lay-verify="required" required/>
                </div>
            </div>
        </div>

        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">状态</label>
                <div class="layui-input-block">
                    <input name="status" type="radio" value="1" title="正常" checked/>
                    <input name="status" type="radio" value="0" title="禁用"/>
                </div>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button id="adminSub" class="layui-btn" lay-filter="adminSub" lay-submit>保存</button>
        </div>
    </div>

</form>

<!-- js部分 -->
<script>
    layui.use(['layer', 'form', 'jquery','table','admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var admin = layui.admin;
        var table = layui.table;
        form.render();
        form.on('submit(adminSub)', function (data) {
            admin.btnLoading('#adminSub');
            $.post("{:url('save')}", data.field, function (res) {
                layer.msg(res.msg, {icon: 1});
                if (res.code === 1) {
                    admin.btnLoading('#adminSub',false);
                    admin.closeDialog('#admin_Add_Form');
                    table.reload('adminTable_id', {page: {curr: 1}});
                }else{
                    layer.msg(res.msg, {icon: 2});
                }
            }, 'json');
            return false;
        });
    });
</script>
